package com.mflex.WHSmartWhouseAd.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.mflex.WHSmartWhouseAd.R;
import com.mflex.WHSmartWhouseAd.model.CombinedVehiclePdaResult;

import java.util.List;

public class CombinedVehicleAdapter extends BaseAdapter {
    List<CombinedVehiclePdaResult> items;
    Activity context;

    public CombinedVehicleAdapter(Activity context, List<CombinedVehiclePdaResult> items) {
        this.context = context;
        this.items = items;
    }

    @Override
    public int getCount() {
        return items.size();
    }

    @Override
    public Object getItem(int position) {
        return items.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        CombinedVehiclePdaResult item = items.get(position);
        View view = convertView;
        view = context.getLayoutInflater().inflate(R.layout.item_combined_vehicle_box, null);
        ((TextView) view.findViewById(R.id.txtMaterialNo)).setText(item.getMaterialNo());
        ((TextView) view.findViewById(R.id.txtLotNo)).setText(item.getLotNo());
        ((TextView) view.findViewById(R.id.txtQty)).setText(item.getQty());
        ((TextView) view.findViewById(R.id.txtPackOrBoxNumber)).setText(item.getPackOrBoxNumber());
        ((TextView) view.findViewById(R.id.txChangeable)).setText(item.getChangeable());
        ((TextView) view.findViewById(R.id.ExpDate)).setText(item.getExpDate());
        return view;
    }
}